<template>
  <div class="max-1">
    <div class="topmax">
      <div
        class="topss"
        v-for="(item, index) in arr"
        :key="index"
        @click="add(item)"
        :class="{ actve: actve === index }"
      >
        {{ item.name }}{{ item.sum }}
      </div>
    </div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="date" label="任务名称" width="180" />
      <el-table-column prop="name" label="申请类型" width="180" />
      <el-table-column prop="address" label="申请人" />
      <el-table-column prop="address" label="申请时间" />
      <el-table-column prop="address" label="任务节点" />
      <el-table-column prop="address" label="最后处理时间" />
      <el-table-column prop="address" label="滞留时长" />
    </el-table>
    <el-pagination
      v-model:current-page="currentPage4"
      v-model:page-size="pageSize4"
      :page-sizes="[100, 200, 300, 400]"
      :small="small"
      :disabled="disabled"
      :background="background"
      layout="total, sizes, prev, pager, next, jumper"
      :total="400"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script lang="ts" setup>
const arr = [
  {
    name: '流程代办',
    sum: 1
  },
  {
    name: '流程已办',
    sum: 1
  },
  {
    name: '其他待办',
    sum: 1
  },
  {
    name: '其他已办',
    sum: 1
  }
]
const tableData = [
  {
    date: '2016-05-03',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles'
  },
  {
    date: '2016-05-02',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles'
  },
  {
    date: '2016-05-04',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles'
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles'
  }
]
const currentPage4 = ref(4)
const pageSize4 = ref(100)
const small = ref(false)
const background = ref(false)
const disabled = ref(false)

const handleSizeChange = (val: number) => {
  console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
  console.log(`current page: ${val}`)
}
const actve = ref()
const add = (item: any) => {
  actve.value = arr.indexOf(item)
}
</script>

<style lang="scss" scoped>
.max-1 {
  min-height: 600px;
}
.topmax {
  display: flex;
}
.topss {
  width: 90px;
  height: 30px;
  color: #000;
  font-size: 12px;
  border: 1px solid #ccc;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
}
.actve {
  color: #fff;
  background: #187ac5;
}
</style>
